/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.product.controller;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
import javax.servlet.ServletOutputStream;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import queenb.net.entitybean.S400;
import queenb.net.entitybean.S450;
import queenb.net.entitybean.V050;
import queenb.web.controller.QueenbController;
import queenb.web.crm.store.CustomerStore;
import queenb.web.product.store.S400Store;
import queenb.web.store.V050Store;
import queenb.web.store.V500Store;
import queenb.web.store.proDetailTour;
import queenb.web.util.ComboboxUtil;
import queenb.web.util.ContextUtil;
import queenb.web.util.SessionProvider;
import queenb.web.util.Util;
import javax.servlet.http.HttpServletResponse;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperReport;
import queenb.web.util.ResourcesProvider;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.pdf.PdfWriter;
import java.io.*;
import com.itextpdf.text.*;
import com.itextpdf.text.BadElementException;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Font;
import com.itextpdf.text.Image;
import com.itextpdf.text.Phrase;


import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import queenb.net.entitybean.V450;
import queenb.web.store.V450Store;

/**
 *
 * @author Nguyen Hung
 */
public class proDetailController extends QueenbController {
    
    private static Font catFont = new Font(Font.FontFamily.HELVETICA, 18,
            Font.BOLD);
    private static Font redFont = new Font(Font.FontFamily.TIMES_ROMAN, 12,
            Font.NORMAL, BaseColor.RED);
    private static Font subFont = new Font(Font.FontFamily.TIMES_ROMAN, 16,
            Font.BOLD);
    private static Font smallBold = new Font(Font.FontFamily.TIMES_ROMAN, 12,
            Font.BOLD);
    private proDetailTour s450Store;
    private int PS450;
    private int FS400;
    private int FV050;// id cua V050
    private byte SB454;
    private int idcomback;// quay lại vẫn lấy List
    private String SV451;// tieu dde tour trong ngay
    private String SV452;// ngay thu 2
    private String SV453;// noi dung tour trong ngay
    private String SV454;// ten image
    private List<S450> listS450 = new ArrayList<S450>();
        private List<V450> listV450 = new ArrayList<V450>();
    private List<V050> listV050 = new ArrayList<V050>();
    private List<S400> listS400 = new ArrayList<S400>();
    private List<SelectItem> listS400Combo = new ArrayList<SelectItem>();
    private int SN455;// so thu tu
    private String messageform;
    private String title;
    // các tham so cho V050
    private int sn408;// so luong nguoi
    private Date datefrom;// Ngày đi
    private Date dateto;// Ngày về
    private int price;// giá
    private String from;// Điểm khởi hành
    private String to;// điêm đến
    private int h1;// gio di
    private int h2;// phut di
    private int h3;// gio den
    private int h4;// phut den
    private int numberdate;
    private String vv052;// Ten Tour
    private int fromID = 373;// id điểm đi
    private int toID;// id điểm đến
    private String notice;
    private int inout;// tour trong va ngoai nuoc
    private List<SelectItem> cbxA000T;
    private List<SelectItem> cbxA000F;
    private int n750;
    private List<SelectItem> combN750 = new ArrayList<SelectItem>();
    private Date D1;
    private int beginFunction;// lay guia tri ngay
    private int idcheckIN_OU = 0;
    private String titleprintTour;// ten tour println
     private int fc475;// Quy trinh VISA
     private List<SelectItem> cbbFC475= (List<SelectItem>) new ArrayList<SelectItem>();
    
    public proDetailController() throws ParseException {
        s450Store = new proDetailTour();
        getKapiMenu().setAdmin(false);
        getKapiMenu().setMainmenu1("m15"); // Hien thi Menu nao dc chon

        Object action = getRequest().getParameter("action");
        Object objectPS450 = getRequest().getParameter("PS450");
        Object objectPS400 = getRequest().getParameter("FS400");
        Object objectFV050 = getRequest().getParameter("FV050");
        if (action != null) {
            if (action.equals("edit")) {
                FS400 = Util.parseInt(objectPS400);
                PS450 = Util.parseInt(objectPS450);
                if (SessionProvider.getSessionMapValue("getFileImage") != null) {
                    SessionProvider.removeSessionMapValue("getFileImage");
                }
                getDetailEditS450(PS450);
            }else if (action.equals("editCopy")) {
               
                FS400 = Util.parseInt(objectPS400);
                PS450 = Util.parseInt(objectPS450);
                FV050 = Util.parseInt(objectFV050);
                if (SessionProvider.getSessionMapValue("getFileImage") != null) {
                    SessionProvider.removeSessionMapValue("getFileImage");
                }
                getDetailEditV450(PS450);
                
            } else if (action.equals("reloadCombobox")) {
                FS400 = Util.parseInt(objectPS400);
                
                
            } else if (action.equals("detailTourCopy")) {
                FS400 = Util.parseInt(objectPS400);
                FV050 = Util.parseInt(objectFV050);
              //  SessionProvider.setSessionMapValue("FS400Id", FS400);
                getListV450();
            } else if (action.equals("detailTour")) {
                FS400 = Util.parseInt(objectPS400);
                SessionProvider.setSessionMapValue("FS400Id", FS400);
                getListS450();
            } else if (action.equals("comback")) {
                if (SessionProvider.getSessionMapValue("FS400Id") != null) {
                    FS400 = Util.parseInt(SessionProvider.getSessionMapValue("FS400Id"));
                    
                }
                System.out.println("----CHạy sau---" + FS400);
            } else if (action.equals("addV050forTour")) {
                FS400 = Util.parseInt(objectPS400);
                Object dateF = getRequest().getParameter("datefrom");
                System.out.println("----NULL---" + dateF);
                if (dateF != null) {
                    String dateString = dateF.toString().replace("-", "/");
                    
                    String demo = dateString.substring(8, 10);
                    String demo2 = dateString.substring(5, 7);
                    String demo3 = dateString.substring(0, 4);
                    
                    
                    String dateTotal = demo + "/" + demo2 + "/" + demo3;
                    
                    datefrom = Util.parseDate(dateTotal, "dd/MM/yyyy");
                    System.out.println("--------String--" + dateTotal + datefrom + Util.toSQLDate(datefrom));
                    SessionProvider.setSessionMapValue("FROM", datefrom);
                }
                Object dateT = getRequest().getParameter("dateto");
                if (dateT != null) {
                    String dateString1 = dateT.toString().replace("-", "/");
                    
                    String demo1 = dateString1.substring(8, 10);
                    String demo5 = dateString1.substring(5, 7);
                    String demo6 = dateString1.substring(0, 4);
                    
                    String dateTotal1 = demo1 + "/" + demo5 + "/" + demo6;
                    dateto = Util.parseDate(dateTotal1, "dd/MM/yyyy");
                    SessionProvider.setSessionMapValue("TO", dateto);
                }
                Object objectFrom = getRequest().getParameter("from");
                if (objectFrom != null) {
                    from = objectFrom.toString();
                }
                Object objectTo = getRequest().getParameter("to");
                if (objectTo != null) {
                    to = objectTo.toString();
                }
                Object objectPrice = getRequest().getParameter("price");
                if (objectPrice != null) {
                    price = Util.parseInt(objectPrice);
                }
                Object objectSN408 = getRequest().getParameter("SN408");
                if (objectSN408 != null) {
                    sn408 = Util.parseInt(objectSN408);
                }
                Object h11 = getRequest().getParameter("h1");
                if (h11 != null) {
                    h1 = Util.parseInt(h11);
                }
                Object h22 = getRequest().getParameter("h2");
                if (h22 != null) {
                    h2 = Util.parseInt(h22);
                }
                Object h33 = getRequest().getParameter("h3");
                if (h33 != null) {
                    h3 = Util.parseInt(h33);
                }
                Object h44 = getRequest().getParameter("h4");
                if (h44 != null) {
                    h4 = Util.parseInt(h44);
                }
                
                Object numberNgay = getRequest().getParameter("SN406");
                if (numberNgay != null) {
                    numberdate = Util.parseInt(numberNgay);
                }
                
                Object idnoiden = getRequest().getParameter("FA000F");
                if (idnoiden != null) {
                    fromID = Util.parseInt(idnoiden);
                }
                
                Object idnoidi = getRequest().getParameter("FA000T");
                if (idnoidi != null) {
                    toID = Util.parseInt(idnoidi);
                }
                
                Object inObject = getRequest().getParameter("inout");
                if (inObject != null) {
                    inout = Util.parseInt(inObject);
                }
                
                Object titleOb = getRequest().getParameter("title");
                if (titleOb != null) {
                    vv052 = titleOb.toString();
                }

                // System.out.println("------- PARAM ON V050----" + datefrom + "--ngay ddeens--" + dateto + "--Noi khoi hanh--" + from + "--ddim den--" + to + "--gias--" + price + "--so nguoi--" + sn408);
            } else if (action.equals("editV050")) {
                FV050 = Util.parseInt(objectFV050);
                FS400 = Util.parseInt(objectPS400);
                SessionProvider.removeSessionMapValue("TO");
                SessionProvider.removeSessionMapValue("FROM");
                if (FV050 != 0) {
                    getDetailEditV050(FV050);
                }
            } else if (action.equals("actionOnOff")) {
                PS450 = Util.parseInt(objectPS450);
                FS400 = Util.parseInt(objectPS400);
                Object titleOb = getRequest().getParameter("title");
                if (titleOb != null) {
                    vv052 = titleOb.toString();
                }
                System.out.println("--------IDDDDDDD-----COUNT---" + PS450 + vv052);
            }else if (action.equals("actionOnOffCopy")) {
                PS450 = Util.parseInt(objectPS450);
                FS400 = Util.parseInt(objectPS400);
                Object objectFV050q = getRequest().getParameter("FV050");
                FV050 = Util.parseInt(objectFV050q);
                Object titleOb = getRequest().getParameter("title");
                if (titleOb != null) {
                    vv052 = titleOb.toString();
                }
                System.out.println("--------IDDDDDDD-----COUNT---" + PS450 + vv052);
            } else if (action.equals("add")) {
                
                Object titleOb = getRequest().getParameter("page");
                if (titleOb != null) {
                    title = titleOb.toString();
                }
                System.out.println("--------add for list Tour---" + title);
            } else if (action.equals("editforTour")) {
                
                Object titleOb = getRequest().getParameter("page");
                if (titleOb != null) {
                    title = titleOb.toString();
                }
                Object FV050Ob = getRequest().getParameter("id");
                if (FV050Ob != null) {
                    FV050 = Util.parseInt(FV050Ob);
                    if (FV050 != 0) {
                        getDetailEditV050ListTour(FV050);
                    }
                }
                if(getLogin().getFn850()==5){
                    setIdcheckIN_OU(1);
                }else if(getLogin().getFn850() == 6){
                    setIdcheckIN_OU(2);
                }else{
                    setIdcheckIN_OU(0);
                }
                
               
                System.out.println("--------add for list Tour---" + title);
            } else if (action.equals("checkupweb")) {
                
                Object titleOb = getRequest().getParameter("FV050");
                if (titleOb != null) {
                    FV050 = Util.parseInt(titleOb);
                    updatecomlumWeb(FV050);
                }
            }
        }
        
    }

    // lay ngay thang
    public static long daysBetween(Calendar startDate, Calendar endDate) {
        Calendar date = (Calendar) startDate.clone();
        long daysBetween = 0;
        while (date.before(endDate)) {
            date.add(Calendar.DAY_OF_MONTH, 1);
            daysBetween++;
        }
        return daysBetween;
    }
    
    public void updatecomlumWeb(int web) {
        try {
            CustomerStore store = new CustomerStore();
            int count = store.updateColumnN100(null, "V050", "VV066", "W", "PV050", web, getLogin().getUserName());
            System.out.println("===================" + count + web);
            if (count > 0) {
                showGlobalReport(true, getResourceString("datasavesuccessful"));
            } else {
                showGlobalReport(true, getResourceString("datasuccessfail"));
            }
        } catch (Exception e) {
        }
    }
    
    public void updateS450() {
        try {
            int count = 0;
            System.out.println("---- demo param---" + this.PS450 + "," + getLogin().getModule() + "," + getLogin().getCompanyNo() + "," + this.FS400 + "," + this.SV451 + "," + this.SV452 + "," + this.SV453 + "," + this.SN455 + "," + getLogin().getUserName());
            count = s450Store.updateS450(this.PS450, getLogin().getModule(), getLogin().getCompanyNo(), this.FS400, this.SV451, this.SV452, this.SV453, this.SN455, getLogin().getUserName());
            
            if (count > 0) {
                setMessageform("CẬP NHẬT THÀNH CÔNG!");
                if (SessionProvider.getSessionMapValue("getFileImage") != null) {
                    CustomerStore customerStore = new CustomerStore();
                    SV454 = SessionProvider.getSessionMapValue("getFileImage").toString();
                    int rs = customerStore.updateColumnN100(null, "S450", "SV454", SV454, "PS450", PS450, getLogin().getUserName());
                    
                    System.out.println("---------- RESULT get Iamge Name -=---" + rs);
                }
            }
            
        } catch (Exception e) {
        }
    }
    
     public void updateV450() {
        try {
            V450Store v450Store = new V450Store();
            int count = 0;
            System.out.println("---- demo param---" + this.PS450 + "," + getLogin().getModule() + "," + getLogin().getCompanyNo() + "," + this.FS400 + "," + this.SV451 + "," + this.SV452 + "," + this.SV453 + "," + this.SN455 + "," + getLogin().getUserName());
            count = v450Store.updateV450(this.PS450, getLogin().getModule(), getLogin().getCompanyNo(),FV050, this.FS400, this.SV451, this.SV452, this.SV453, this.SN455, getLogin().getUserName());
            
            if (count > 0) {
                setMessageform("CẬP NHẬT THÀNH CÔNG!");
                if (SessionProvider.getSessionMapValue("getFileImage") != null) {
                    CustomerStore customerStore = new CustomerStore();
                    SV454 = SessionProvider.getSessionMapValue("getFileImage").toString();
                    int rs = customerStore.updateColumnN100(null, "V450", "VV454", SV454, "PV450", PS450, getLogin().getUserName());
                    
                    System.out.println("---------- RESULT get Iamge Name -=---" + rs);
                }
            }
            
        } catch (Exception e) {
        }
    }
    
    public void updateV050forS400ON() {
        try {
            
            
            int count = 0;
            
            count = s450Store.updateS450ON(PS450, getLogin().getUserName());
            System.out.println("-------------COUNT---" + count + PS450 + FS400);
            if (count >= 0) {
                
                sendRedirectUrlTab("productTour.jsp?action=detailTour&FS400=" + FS400);
                showGlobalReport(true, getResourceString("datasavesuccessful"));
            } else {
                showGlobalReport(true, getResourceString("datasuccessfail"));
            }
            
        } catch (Exception e) {
        }
    }
    
    // ON for V450
     public void updateV050forS400ONCOPY() {
        try {
            
            
            int count = 0;
            V450Store v450Store = new V450Store();
            count = v450Store.updateV450ON(PS450, getLogin().getUserName());
            System.out.println("-------------COUNT---" + count + PS450 + FS400);
            if (count >= 0) {
                
                sendRedirectUrlTab("productTourCopy.jsp?action=detailTourCopy&FS400=" + FS400+"&FV050="+FV050);
                showGlobalReport(true, getResourceString("datasavesuccessful"));
            } else {
                showGlobalReport(true, getResourceString("datasuccessfail"));
            }
            
        } catch (Exception e) {
        }
    }
     
      public void updateV450UPDATE() {
        try {
            
            
            int count = 0;
            V450Store v450Store = new V450Store();
            count = v450Store.updateV450UPDATE(getLogin().getModule(),getLogin().getCompanyNo(),FV050,FS400, getLogin().getUserName());
            System.out.println("-------------COUNT---" + count + FV050 + FS400);
            System.out.println("-------------COUNT---" + count + "FV050==="+ FV050 + "FS400==="+ FS400);
            if (count >= 0) {
                
                sendRedirectUrlTab("productTourCopy.jsp?action=detailTourCopy&FS400=" + FS400+"&FV050="+FV050);
                showGlobalReport(true, getResourceString("datasavesuccessful"));
            } else {
                showGlobalReport(true, getResourceString("datasuccessfail"));
            }
            
        } catch (Exception e) {
        }
    }
      
      
    JasperPrint jasperPrint;
    InputStream inputStream = null;
    
    ;
    public void init() throws JRException {
        List<S450> lisstPDF = s450Store.getListS450(getLogin().getModule(), getLogin().getCompanyNo(), 20, getLogin().getUserName());
        JRBeanCollectionDataSource beanCollectionDataSource = new JRBeanCollectionDataSource(lisstPDF);
        HashMap hm = new HashMap();
        hm.put("parametroNombre", this.SV451);
        hm.put("fechaInicio", this.SV452);
        hm.put("fechaFin", this.SV453);
        String inputStreams = "/report2.jasper";

        //  String  reportPath=  ResourcesProvider.getReportFolder();
        // System.out.println("aaaaaaaaabbbbbbbbb------"+reportPath);
        FacesContext context = FacesContext.getCurrentInstance();
        inputStream =
                context.getExternalContext().getResourceAsStream("C:/Users/Nguyen Hung/Desktop/report2.jasper");
        
        JasperReport jr = JasperCompileManager.compileReport("C:\\Users\\Nguyen Hung\\Desktop\\report2.jrxml");
        jasperPrint = JasperFillManager.fillReport(jr, hm, beanCollectionDataSource);
        
    }

    
    public void reportPDF(ActionEvent ev) throws JRException, IOException {
        try {
            init();
            List<S450> lisstPDF = s450Store.getListS450(getLogin().getModule(), getLogin().getCompanyNo(), 20, getLogin().getUserName());
            System.out.println("- print demo Jasper-------" + lisstPDF.size());
            
            HttpServletResponse httpServletResponse = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
            httpServletResponse.addHeader("Print Tour ", "attachment filename=report.pdf");
            ServletOutputStream servletOutputStream = httpServletResponse.getOutputStream();
            System.out.println("- print demo Jasper111-------" + lisstPDF.size());
            JasperExportManager.exportReportToPdfStream(jasperPrint, servletOutputStream);
        } catch (IOException e) {
            System.out.println("aaaaaaaaa------" + e.getMessage());
        }
        
    }
    
    public static PdfPTable createFirstTable(String title, String content) {
        try {
            BaseFont base1 = null;
            BaseFont base;
            
            base = BaseFont.createFont("C:\\Windows\\Fonts\\Arial.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
            Font font = new Font(base, 8f, Font.NORMAL);
            // a table with three columns
            PdfPTable table = new PdfPTable(3);

            // the cell object
            PdfPCell cell;
            // now we add a cell with rowspan 2
            cell = new PdfPCell(new Phrase("Url Image Tour"));
            cell.setRowspan(2);
            
            table.addCell(cell);
            // we add the four remaining cells with addCell()
            // title
            cell = new PdfPCell(new Phrase(title, font));
            cell.setColspan(2);
            table.addCell(cell);
            
            cell = new PdfPCell(new Phrase(content, FontFactory.getFont(FontFactory.HELVETICA, 8)));
            cell.setColspan(2);
            table.addCell(cell);
            
            return table;
        } catch (DocumentException ex) {
            Logger.getLogger(proDetailController.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IOException ex) {
            Logger.getLogger(proDetailController.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    
    public static PdfPTable createFirstTableHeader(Image img) {

        // a table with three columns
        PdfPTable table = new PdfPTable(3);
        // the cell object
        PdfPCell cell;
        // we add a cell with colspan 3

        cell = new PdfPCell(img);
        cell.setColspan(3);
        table.addCell(cell);
        
        return table;
        
    }
    
    public static PdfPTable createFirstTableFooter(Image img) {
        // a table with three columns
        PdfPTable table = new PdfPTable(3);
        // the cell object
        PdfPCell cell;
        // we add a cell with colspan 3
        cell = new PdfPCell(img);
        cell.setColspan(3);
        table.addCell(cell);
        return table;
    }
    
    public void reportPDF1(ActionEvent ev) throws DocumentException {
        try {
            String s = getRequest().getRequestURL().toString();
            String[] arr = new String[20];
            arr = s.split("/");
            String url = "";
            if (arr.length > 3) {
                url = arr[0] + "/" + arr[1] + "/" + arr[2] + "/";
            }
            Document document = new Document();
            String filepath = ResourcesProvider.getReportExcel();
            System.out.println("-----------EXPORT FILE PDF-----" + filepath);
            Long dateee = new Date().getTime();
            File fileout = new File(ResourcesProvider.getReportExcel() + "report" + dateee + ".pdf");
            FileOutputStream fileOut = new FileOutputStream(fileout);
            // PdfWriter.getInstance(document, new FileOutputStream("C:\\Users\\Nguyen Hung\\Desktop\\hello.pdf"));
            PdfWriter.getInstance(document, fileOut);
            document.open();
            //Image imageHeader = Image.getInstance ("../images/headerPDF.jpg");
            String imageUrl = "http://kapi.saigon-travel.com/resources/kapi/ca31a937-7e63-471f-8ba7-b74f1edc1b7e_headerPDF.jpg";
            
            Image image2 = Image.getInstance(new URL(imageUrl));
            image2.scaleToFit(460, 150);
            image2.setAbsolutePosition(100, 0);
            // Image imageHeader = Image.getInstance("headerPDF.jpg");

            document.add(createFirstTableHeader(image2));
            //Image imageHeader1 = Image.getInstance("footerPDF.jpg");


            // document.add(createFirstTableHeader(imageHeader));
            List<S450> lisstPDF = s450Store.getListS450(getLogin().getModule(), getLogin().getCompanyNo(), 20, getLogin().getUserName());
            if (lisstPDF != null || lisstPDF.size() > 0) {
                for (int i = 0; i < lisstPDF.size(); i++) {
                    //String image = ResourcesProvider.getDownloadFolder(lisstPDF.get(i).getSV454());
                    //Image imggg = Image.getInstance(new URL(image));
                    //  document.add(createFirstTable(lisstPDF.get(i).getSV453(), lisstPDF.get(i).getSV452(), imggg));

                    document.add(createFirstTable(lisstPDF.get(i).getSV453(), lisstPDF.get(i).getSV452()));
                    
                }
            }
            // document.add(createFirstTableFooter(imageHeader1));

            String imageUrlFooter = "http://kapi.saigon-travel.com/resources/kapi/8262bb94-2e75-48b3-9734-0701d8e64882_footerPDF.jpg";
            Image image3 = Image.getInstance(new URL(imageUrlFooter));
            image3.scaleToFit(1000, 200);
            image2.setAbsolutePosition(100, 0);
            
            document.add(createFirstTableFooter(image3));
            
            
            document.close();
            
            sendRedirect(url + "resources/excel/report" + dateee + ".pdf");
            //sendRedirect("D://Nguyen Tung//QueenbProject//CurrentProject//SAIGON-TRAVEL//kapi2//build//web//resources//excel//report.pdf");
            System.out.println("sendRedirect----:" + ResourcesProvider.getReportExcel());
            System.out.println("url----:" + url + "resources/excel/report" + dateee + ".pdf");
        } catch (BadElementException ex) {
            Logger.getLogger(proDetailController.class.getName()).log(Level.SEVERE, null, ex);
        } catch (MalformedURLException ex) {
            Logger.getLogger(proDetailController.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(proDetailController.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    public void updateV050forS400OFF() {
        try {
            
            
            int count = 0;
            
            count = s450Store.updateS450OFF(PS450, getLogin().getUserName());
            System.out.println("-------------COUNT---" + count + PS450 + FS400);
            if (count >= 0) {
                
                sendRedirectUrlTab("productTour.jsp?action=detailTour&FS400=" + FS400);
                showGlobalReport(true, getResourceString("datasavesuccessful"));
            } else {
                showGlobalReport(true, getResourceString("datasuccessfail"));
            }
            
        } catch (Exception e) {
        }
    }
    
    // OFF for V450
     public void updateV050forS400OFFCOPY() {
        try {
            
            
            int count = 0;
             V450Store v450Store = new V450Store();
            count = v450Store.updateV450OFF(PS450, getLogin().getUserName());
            System.out.println("-------------COUNT---" + count + PS450 + FS400);
            if (count >= 0) {
                
                sendRedirectUrlTab("productTourCopy.jsp?action=detailTourCopy&FS400=" + FS400+"&FV050="+FV050);
                showGlobalReport(true, getResourceString("datasavesuccessful"));
            } else {
                showGlobalReport(true, getResourceString("datasuccessfail"));
            }
            
        } catch (Exception e) {
        }
    }

    // Update cho V050 for S400
    public void updateV050forS400() {
        try {
            
            V050Store v050Store = new V050Store();
            V450Store v450Store = new V450Store();
            int count = 0;
            System.out.println("----FV050---" + FV050 + "----FS400----" + FS400 + "------- PARAM ON V050----" + datefrom + "--ngay ddeens--" + dateto + "--Noi khoi hanh--" + from + "--ddim den--" + to + "--gias--" + price + "--so nguoi--" + sn408 + "--h1--" + h1 + "--h2--" + h2 + "--h3--" + h3 + "--h4--" + h4);
            if (SessionProvider.getSessionMapValue("TO") != null) {
                dateto = (Date) SessionProvider.getSessionMapValue("TO");
            }
            if (SessionProvider.getSessionMapValue("FROM") != null) {
                datefrom = (Date) SessionProvider.getSessionMapValue("FROM");
            }
            count = v050Store.updateV050ForS400(0, getLogin().getModule(), getLogin().getCompanyNo(), this.FS400, this.vv052, this.sn408, this.numberdate, this.price,Util.UnUnicode(vv052), this.from, this.to, Util.toSQLDate(this.datefrom), Util.toSQLDate(this.dateto), this.h1, this.h2, this.h3, this.h4, this.inout, this.fromID, this.toID, getLogin().getUserName());
              System.out.println("-------------COUNT11111---" + count);
            if (count > 0) {
                
                sendRedirectUrlTab("codeproductTour.jsp?action=detailTour&FS400=" + FS400);
                showGlobalReport(true, getResourceString("datasavesuccessful"));
               int count2 = v450Store.updateV450(PS450, getLogin().getModule(), getLogin().getCompanyNo(), count, FS400, SV451, SV452, SV453, SN455, getLogin().getUserName());
                  System.out.println("-------------COUNT---" + count2);
            } else {
                showGlobalReport(true, getResourceString("datasuccessfail"));
            }
            
        } catch (Exception e) {
        }
    }
    
    
    // Edit V050 for S400
    public void updateV050forS400F() {
        try {
            String dateStart = ContextUtil.getRequestParameter("from");
            if (!dateStart.equals("")) {
                datefrom = Util.parseDate(dateStart, "dd/MM/yyyy");
            } else {
                datefrom = null;
            }
            
            String dateend = ContextUtil.getRequestParameter("to");
            if (!dateend.equals("")) {
                dateto = Util.parseDate(dateend, "dd/MM/yyyy");
            } else {
                dateto = null;
                
            }
            V500Store v500Store = new V500Store();
            int count = 0;
            System.out.println("----FV050---" + FV050 + inout + "----FS400----" + FS400 + "------- PARAM ON V050----" + datefrom + "--ngay ddeens--" + dateto + "--Noi khoi hanh--" + from + "--ddim den--" + to + "--gias--" + price + "--so nguoi--" + sn408 + "--h1--" + h1 + "--h2--" + h2 + "--h3--" + h3 + "--h4--" + h4);
            System.out.println("-- THÔNG SOOa-----" + FV050 + "," + getLogin().getModule() + "," + getLogin().getCompanyNo() + "," + this.FS400 + "," + null + "," + this.vv052 + "," + this.sn408 + "," + this.numberdate + "," + this.price + "," + 0 + "," + 0 + "," + 0 + "," + 0 + "," + 0 + "," + 0 + "," + 0 + "," + 0 + "," + 0 + "," + null + "," + null + "," + this.from + "," + this.to + "," + notice + "," + this.sn408 + "," + Util.toSQLDate(this.dateto) + "," + Util.toSQLDate(this.datefrom) + "," + this.h1 + "," + this.h2 + "," + this.h3 + "," + this.h4 + "," + this.inout + "," + fromID + "," + toID + "," + getLogin().getUserName());
            count = v500Store.updateV050End(FV050, getLogin().getModule(), getLogin().getCompanyNo(), this.FS400, null, this.vv052, this.sn408, this.numberdate, this.price, 0, 0, 0, 0, 0, 0, 0, 0, 0, null, null,Util.UnUnicode(vv052), this.from, this.to, notice, this.sn408, Util.toSQLDate(this.dateto), Util.toSQLDate(this.datefrom), this.h1, this.h2, this.h3, this.h4, this.inout, fromID, toID, getLogin().getUserName());
            System.out.println("-------------COUNT---" + count + fromID + toID + numberdate + FV050);
            System.out.println(title+"-----updatec575----:"+fc475+"-----"+FV050);
            if(count >= 0 && fc475 > 0){
                CustomerStore  cus = new CustomerStore();
            System.out.println("-----updatec575-aaa---:"+fc475+"-----"+FV050);
//            int rs =  c575Store.updateC575(pnPC575, "F", pvCV580, getLogin().getUserName());
            count = cus.updateColumnN100(null, "V050", "FC475", String.valueOf(fc475), "PV050", FV050, getLogin().getUserName());
            }
            if (count >= 0) {
                if (title.equals("")) {
                    sendRedirectUrlTab("codeproductTour.jsp?action=detailTour&FS400=" + FS400);
                    showGlobalReport(true, getResourceString("datasavesuccessful"));
                } else if (title.equals("listTour.jsp")) {
                    sendRedirectUrlTab("listTour.jsp");
                    showGlobalReport(true, getResourceString("datasavesuccessful"));
                } else if (title.equals("managerSale.jsp")) {
                    sendRedirectUrlTab("managerSale.jsp");
                    showGlobalReport(true, getResourceString("datasavesuccessful"));
                }
                
            } else {
                showGlobalReport(true, getResourceString("datasuccessfail"));
            }
            
        } catch (Exception e) {
        }
    }
    
    public List<S450> getListS450() {
        try {
            
            
            listS450 = s450Store.getListS450(getLogin().getModule(), getLogin().getCompanyNo(), this.FS400, getLogin().getUserName());
            if (listS450.size() > 0) {
                title = listS450.get(0).getSV401();
                if(title != null){
                    SessionProvider.setSessionMapValue("TITLETOURPRINT", title);
                }
                System.out.println("----------TITLE------- " + title + listS450.get(0).getStart() + listS450.get(0).getSl465());
            }
            
            return listS450;
        } catch (Exception e) {
            return null;
        }
    }
    
    
    // List san pham  Copy Toyur
    public List<V450> getListV450() {
        try {
             System.out.println("----------ACCCCCCCCCCCCCCCCCCCCCCC------- " + FV050+FS400);
            V450Store v450Store = new V450Store();
            listV450 = v450Store.getListV450(getLogin().getModule(), getLogin().getCompanyNo(),FV050, this.FS400, getLogin().getUserName());
            if (listV450.size() > 0) {
                title = listV450.get(0).getSV401();
                if(title != null){
                    SessionProvider.setSessionMapValue("TITLETOURPRINT", title);
                }
                System.out.println("----------TITLE------- " + title);
            }
            
            return listV450;
        } catch (Exception e) {
            return null;
        }
    }
    
    public void reloadCombobox(ActionEvent ac) {
        
        SessionProvider.setSessionMapValue("FS400Id", FS400);
        sendRedirect("codeproductTour.jsp?action=reloadCombobox&FS400=" + FS400 + "&");
    }
    // List danh sahc |Tour

    public List<S400> getListS400() {
        try {
            S400Store s400Store = new S400Store();
//            if (SessionProvider.getSessionMapValue("FS400Id") != null) {
//                FS400 = Util.parseInt(SessionProvider.getSessionMapValue("FS400Id"));
//            }
            listS400 = s400Store.LISTOFTABS400(getLogin().getModule(), getLogin().getCompanyNo(), FS400, 0, 0, 0, 0, 0, 0, getLogin().getUserName());
            System.out.println("---------LIST S400------- " + listS400.size());
            return listS400;
        } catch (Exception e) {
            return null;
        }
    }
    
    public List<S450> getListS450OFF(int id) {
        try {
            
            
            listS450 = s450Store.getListS450(getLogin().getModule(), getLogin().getCompanyNo(), id, getLogin().getUserName());
            if (listS450.size() > 0) {
                title = listS450.get(0).getSV401();
                System.out.println("----------TITLE------- " + title);
            }
            
            return listS450;
        } catch (Exception e) {
            return null;
        }
    }
    
    public List<V050> getListV050() {
        try {
            V050Store store = new V050Store();
            
            listV050 = store.listV050(getLogin().getModule(), getLogin().getCompanyNo(), 0, 0, getLogin().getUserName());
            
            return listV050;
        } catch (Exception e) {
            return null;
        }
    }

    // edit cho V050 for S400
    public void getDetailEditV050(int id) {
        try {
            List<V050> listV050Edit = getListV050();
            if (listV050Edit.size() > 0) {
                for (int i = 0; i < listV050Edit.size(); i++) {
                    if (listV050Edit.get(i).getFv050() == id) {
                        this.FV050 = listV050Edit.get(i).getFv050();
                        
                        this.sn408 = listV050Edit.get(i).getVn053();
                        this.datefrom = listV050Edit.get(i).getVd073();
                        
                        this.price = listV050Edit.get(i).getVn055();
                        this.from = listV050Edit.get(i).getVv069();
                        this.to = listV050Edit.get(i).getVv070();
                        this.h1 = listV050Edit.get(i).getVn075();
                        
                        this.h2 = listV050Edit.get(i).getVn076();
                        this.h3 = listV050Edit.get(i).getVn077();
                        this.h4 = listV050Edit.get(i).getVn078();
                        this.numberdate = listV050Edit.get(i).getVn054();
                        this.fromID = listV050Edit.get(i).getFa000f();
                        this.toID = listV050Edit.get(i).getFa000t();
                        this.vv052 = listV050Edit.get(i).getVv052();
                        notice = listV050Edit.get(i).getVv071();
                        inout = listV050Edit.get(i).getVn079();
                        System.out.println("---------ID FV050------- " + vv052);
//                        this.SV451 = listV050Edit.get(i).getSV451();
//                        this.SV452 = listV050Edit.get(i).getSV452();
//                        this.SV453 = listV050Edit.get(i).getSV453();
//
//                        this.FS400 = listV050Edit.get(i).getFS400();
                        break;
                    }
                }
            }
        } catch (Exception ex) {
            System.out.println("Error when getDetailEditN850. ERROR CODE: " + ex.getMessage());
        }
    }
    
    public void getDetailEditV050ListTour(int id) {
        try {
            V050Store v050Store = new V050Store();
            List<V050> listV050Edit = v050Store.getListAllV050SGTN(getLogin().getModule(), getLogin().getCompanyNo(), id, null, null, null, getLogin().getUserName());
            if (listV050Edit.size() > 0) {
                for (int i = 0; i < listV050Edit.size(); i++) {
                    if (listV050Edit.get(i).getFv050() == id) {
                        this.FV050 = listV050Edit.get(i).getFv050();
                        
                        this.sn408 = listV050Edit.get(i).getVn053();
                        this.datefrom = listV050Edit.get(i).getVd073();
                        this.dateto = listV050Edit.get(i).getVd074();
                        
                        if (datefrom != null) {
                            SessionProvider.setSessionMapValue("DATEFROMTOURDEFAULT", datefrom);
                        }
                        this.dateto = listV050Edit.get(i).getVd074();
                        if (dateto != null) {
                            SessionProvider.setSessionMapValue("DATEFROMTOURDEFAULTTO", dateto);
                        }
                        this.price = listV050Edit.get(i).getVn055();
                        this.from = listV050Edit.get(i).getVv069();
                        this.to = listV050Edit.get(i).getVv070();
                        this.h1 = listV050Edit.get(i).getVn075();
                        
                        this.h2 = listV050Edit.get(i).getVn076();
                        this.h3 = listV050Edit.get(i).getVn077();
                        this.h4 = listV050Edit.get(i).getVn078();
                        this.numberdate = listV050Edit.get(i).getVn054();
                        this.fromID = listV050Edit.get(i).getFa000f();
                        this.toID = listV050Edit.get(i).getFa000t();
                        this.vv052 = listV050Edit.get(i).getVv052();
                        notice = listV050Edit.get(i).getVv071();
                        inout = listV050Edit.get(i).getVn079();
                        n750 = listV050Edit.get(i).getFn750();
                        fc475 = listV050Edit.get(i).getFc475();

//                        this.SV451 = listV050Edit.get(i).getSV451();
//                        this.SV452 = listV050Edit.get(i).getSV452();
//                        this.SV453 = listV050Edit.get(i).getSV453();
//
//                        this.FS400 = listV050Edit.get(i).getFS400();
                        break;
                    }
                }
            }
        } catch (Exception ex) {
            System.out.println("Error when getDetailEditN850. ERROR CODE: " + ex.getMessage());
        }
    }
    // v050Store.getListAllV050SGTN(getLogin().getModule(), getLogin().getCompanyNo(), 0, null, null, null, getLogin().getUserName());

    public void getDetailEditS450(int id) {
        try {
            List<S450> listS450Edit = getListS450();
            if (listS450Edit.size() > 0) {
                for (int i = 0; i < listS450Edit.size(); i++) {
                    if (listS450Edit.get(i).getPS450() == id) {
                        this.SV451 = listS450Edit.get(i).getSV451();
                        this.SV452 = listS450Edit.get(i).getSV452();
                        this.SV453 = listS450Edit.get(i).getSV453();
                        
                        this.FS400 = listS450Edit.get(i).getFS400();
                        break;
                    }
                }
            }
        } catch (Exception ex) {
            System.out.println("Error when getDetailEditN850. ERROR CODE: " + ex.getMessage());
        }
    }
    
     public void getDetailEditV450(int id) {
        try {
            List<V450> listV450Edit = getListV450();
            if (listV450Edit.size() > 0) {
                for (int i = 0; i < listV450Edit.size(); i++) {
                    if (listV450Edit.get(i).getPV450() == id) {
                        this.SV451 = listV450Edit.get(i).getVV451();
                        this.SV452 = listV450Edit.get(i).getVV452();
                        this.SV453 = listV450Edit.get(i).getVV453();
                        
                        this.FS400 = listV450Edit.get(i).getFS400();
                        break;
                    }
                }
            }
        } catch (Exception ex) {
            System.out.println("Error when getDetailEditN850. ERROR CODE: " + ex.getMessage());
        }
    }
    
    public void onCountrySelected(ValueChangeEvent ev) {
        System.out.println("demo --------");
        getCbxA000F();
    }

    /**
     * @return the FS400
     */
    public int getFS400() {
        
        return FS400;
    }

    /**
     * @param FS400 the FS400 to set
     */
    public void setFS400(int FS400) {
        this.FS400 = FS400;
    }

    /**
     * @return the SV451
     */
    public String getSV451() {
        return SV451;
    }

    /**
     * @param SV451 the SV451 to set
     */
    public void setSV451(String SV451) {
        this.SV451 = SV451;
    }

    /**
     * @return the SV452
     */
    public String getSV452() {
        return SV452;
    }

    /**
     * @param SV452 the SV452 to set
     */
    public void setSV452(String SV452) {
        this.SV452 = SV452;
    }

    /**
     * @return the SV453
     */
    public String getSV453() {
        return SV453;
    }

    /**
     * @param SV453 the SV453 to set
     */
    public void setSV453(String SV453) {
        this.SV453 = SV453;
    }

    /**
     * @return the SN455
     */
    public int getSN455() {
        return SN455;
    }

    /**
     * @param SN455 the SN455 to set
     */
    public void setSN455(int SN455) {
        this.SN455 = SN455;
    }

    /**
     * @return the SB454
     */
    public byte getSB454() {
        return SB454;
    }

    /**
     * @param SB454 the SB454 to set
     */
    public void setSB454(byte SB454) {
        this.SB454 = SB454;
    }

    /**
     * @return the PS450
     */
    public int getPS450() {
        return PS450;
    }

    /**
     * @param PS450 the PS450 to set
     */
    public void setPS450(int PS450) {
        this.PS450 = PS450;
    }

    /**
     * @return the messageform
     */
    public String getMessageform() {
        return messageform;
    }

    /**
     * @param messageform the messageform to set
     */
    public void setMessageform(String messageform) {
        this.messageform = messageform;
    }

    /**
     * @return the SV454
     */
    public String getSV454() {
        return SV454;
    }

    /**
     * @param SV454 the SV454 to set
     */
    public void setSV454(String SV454) {
        this.SV454 = SV454;
    }

    /**
     * @return the listS400Combo
     */
    public List<SelectItem> getListS400Combo() {
        ComboboxUtil combos = new ComboboxUtil();
        listS400Combo = combos.getListCombS400();
        return listS400Combo;
    }

    /**
     * @param listS400Combo the listS400Combo to set
     */
    public void setListS400Combo(List<SelectItem> listS400Combo) {
        this.listS400Combo = listS400Combo;
    }

    /**
     * @return the title
     */
    public String getTitle() {
        
        return title;
    }

    /**
     * @param title the title to set
     */
    public void setTitle(String title) {
        this.title = title;
    }

    /**
     * @return the idcomback
     */
    public int getIdcomback() {
        if (SessionProvider.getSessionMapValue("FS400Id") != null) {
            idcomback = Util.parseInt(SessionProvider.getSessionMapValue("FS400Id"));
            
        }
        System.out.println("--Comback---" + idcomback);
        return idcomback;
    }

    /**
     * @param idcomback the idcomback to set
     */
    public void setIdcomback(int idcomback) {
        this.idcomback = idcomback;
    }

    /**
     * @return the sn408
     */
    public int getSn408() {
        return sn408;
    }

    /**
     * @param sn408 the sn408 to set
     */
    public void setSn408(int sn408) {
        this.sn408 = sn408;
    }

    /**
     * @return the datefrom
     */
    public Date getDatefrom() {
        //  System.out.println("---------AA-------"+ datefrom);
        return datefrom;
    }

    /**
     * @param datefrom the datefrom to set
     */
    public void setDatefrom(Date datefrom) {
        this.datefrom = datefrom;
    }

    /**
     * @return the dateto
     */
    public Date getDateto() {
        return dateto;
    }

    /**
     * @param dateto the dateto to set
     */
    public void setDateto(Date dateto) {
        this.dateto = dateto;
    }

    /**
     * @return the price
     */
    public int getPrice() {
        return price;
    }

    /**
     * @param price the price to set
     */
    public void setPrice(int price) {
        this.price = price;
    }

    /**
     * @return the from
     */
    public String getFrom() {
        return from;
    }

    /**
     * @param from the from to set
     */
    public void setFrom(String from) {
        this.from = from;
    }

    /**
     * @return the to
     */
    public String getTo() {
        return to;
    }

    /**
     * @param to the to to set
     */
    public void setTo(String to) {
        this.to = to;
    }

    /**
     * @return the h1
     */
    public int getH1() {
        return h1;
    }

    /**
     * @param h1 the h1 to set
     */
    public void setH1(int h1) {
        this.h1 = h1;
    }

    /**
     * @return the h2
     */
    public int getH2() {
        return h2;
    }

    /**
     * @param h2 the h2 to set
     */
    public void setH2(int h2) {
        this.h2 = h2;
    }

    /**
     * @return the h3
     */
    public int getH3() {
        return h3;
    }

    /**
     * @param h3 the h3 to set
     */
    public void setH3(int h3) {
        this.h3 = h3;
    }

    /**
     * @return the h4
     */
    public int getH4() {
        return h4;
    }

    /**
     * @param h4 the h4 to set
     */
    public void setH4(int h4) {
        this.h4 = h4;
    }

    /**
     * @return the FV050
     */
    public int getFV050() {
        return FV050;
    }

    /**
     * @param FV050 the FV050 to set
     */
    public void setFV050(int FV050) {
        this.FV050 = FV050;
    }

    /**
     * @return the numberdate
     */
    public int getNumberdate() {
        return numberdate;
    }

    /**
     * @param numberdate the numberdate to set
     */
    public void setNumberdate(int numberdate) {
        this.numberdate = numberdate;
    }

    /**
     * @return the vv052
     */
    public String getVv052() {
        return vv052;
    }

    /**
     * @param vv052 the vv052 to set
     */
    public void setVv052(String vv052) {
        this.vv052 = vv052;
    }

    /**
     * @return the fromID
     */
    public int getFromID() {
        return fromID;
    }

    /**
     * @param fromID the fromID to set
     */
    public void setFromID(int fromID) {
        this.fromID = fromID;
    }

    /**
     * @return the toID
     */
    public int getToID() {
        return toID;
    }

    /**
     * @param toID the toID to set
     */
    public void setToID(int toID) {
        this.toID = toID;
    }

    /**
     * @return the notice
     */
    public String getNotice() {
        return notice;
    }

    /**
     * @param notice the notice to set
     */
    public void setNotice(String notice) {
        this.notice = notice;
    }

    /**
     * @return the inout
     */
    public int getInout() {
        return inout;
    }

    /**
     * @param inout the inout to set
     */
    public void setInout(int inout) {
        this.inout = inout;
    }

    /**
     * @return the cbxA000T
     */
    public List<SelectItem> getCbxA000T() {
        ComboboxUtil cbxUtil = new ComboboxUtil();
        try {
            int flag = 0;
            System.out.println("D:- Pham vi tour: " + inout);
            Object obj = SessionProvider.getSessionMapValue("inout");
            if (obj != null) {
                System.out.println("D:- Pham vi tour session:" + SessionProvider.getSessionMapValue("inout").toString());
                try {
                    flag = Integer.parseInt(obj.toString());
                } catch (Exception e) {
                }
            }
            
            if (flag == 0) {
                cbxA000T = cbxUtil.getListCombA000_SP(1);
            } else {
                Object objn750 = SessionProvider.getSessionMapValue("n750Pros");
                if (objn750 != null) {
                    System.out.println("D:- objn750 : " + objn750);
                    int a = 0;
                    try {
                        a = Integer.parseInt(objn750.toString());
                    } catch (Exception e) {
                    }
                    cbxA000T = cbxUtil.getListCombA000DV(a);
                } else {
                    cbxA000T = cbxUtil.getListCombA000DV(0);
                }
                
            }
            
        } catch (Exception e) {
            cbxA000T = new ArrayList<SelectItem>();
        }
        
        return cbxA000T;
    }
    public List<SelectItem> getCbbFC475() {
         try {
            ComboboxUtil cbb =new ComboboxUtil();
            cbbFC475 = cbb.getSelectedC475Comb();
        } catch (Exception e) {
        }
        return cbbFC475;
    }

    /**
     * @param cbxA000T the cbxA000T to set
     */
    public void setCbxA000T(List<SelectItem> cbxA000T) {
        this.cbxA000T = cbxA000T;
    }

    /**
     * @return the cbxA000F
     */
    public List<SelectItem> getCbxA000F() {
        try {
            ComboboxUtil cbxUtil = new ComboboxUtil();
            cbxA000F = cbxUtil.getListCombA000_SP(0);
        } catch (Exception e) {
            cbxA000F = new ArrayList<SelectItem>();
        }
        return cbxA000F;
    }

    /**
     * @param cbxA000F the cbxA000F to set
     */
    public void setCbxA000F(List<SelectItem> cbxA000F) {
        this.cbxA000F = cbxA000F;
    }

    /**
     * @return the n750
     */
    public int getN750() {
        return n750;
    }

    /**
     * @param n750 the n750 to set
     */
    public void setN750(int n750) {
        this.n750 = n750;
    }
    
    public void changetarget(ActionEvent ac) {
        System.out.println("D:---change changetarget " + inout);
        SessionProvider.setSessionMapValue("inout", inout);
    }
    
    public void changeCountry(ActionEvent ac) {
        System.out.println("D:---change Country " + n750);
        SessionProvider.setSessionMapValue("n750Pros", n750);
        
    }

    /**
     * @return the combN750
     */
    public List<SelectItem> getCombN750() {
        combN750 = new ArrayList<SelectItem>();
        int f = 0;
        System.out.println("D:- vn079: " + inout);
        Object obj = SessionProvider.getSessionMapValue("inout");
        if (obj != null) {
            System.out.println("D:- vn079ss" + obj.toString());
            try {
                f = Integer.parseInt(obj.toString());
            } catch (Exception e) {
            }
        }
        
        if (f == 0) {
            SelectItem item = new SelectItem("1", "Viet Nam");
            combN750.add(item);
        } else {
            ComboboxUtil combo = new ComboboxUtil();
            combN750 = combo.getlistCombN750DVT();
        }
        SessionProvider.setSessionMapValue("n750Pros", combN750.get(0));
        return combN750;
    }

    /**
     * @param combN750 the combN750 to set
     */
    public void setCombN750(List<SelectItem> combN750) {
        this.combN750 = combN750;
    }

    /**
     * @return the beginFunction
     */
    public int getBeginFunction() {
       
        return beginFunction;
    }

    /**
     * @param beginFunction the beginFunction to set
     */
    public void setBeginFunction(int beginFunction) {
        this.beginFunction = beginFunction;
    }

    /**
     * @return the idcheckIN_OU
     */
    public int getIdcheckIN_OU() {
        return idcheckIN_OU;
    }

    /**
     * @param idcheckIN_OU the idcheckIN_OU to set
     */
    public void setIdcheckIN_OU(int idcheckIN_OU) {
        this.idcheckIN_OU = idcheckIN_OU;
    }

    /**
     * @return the titleprintTour
     */
    public String getTitleprintTour() {
        if(SessionProvider.getSessionMapValue("TITLETOURPRINT")!= null){
            titleprintTour = SessionProvider.getSessionMapValue("TITLETOURPRINT").toString();
        }
        return titleprintTour;
    }

    /**
     * @param titleprintTour the titleprintTour to set
     */
    public void setTitleprintTour(String titleprintTour) {
        this.titleprintTour = titleprintTour;
    }

    /**
     * @return the fc475
     */
    public int getFc475() {
        return fc475;
    }

    /**
     * @param fc475 the fc475 to set
     */
    public void setFc475(int fc475) {
        this.fc475 = fc475;
    }
}
